package com.icss;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.context.annotation.Bean;

/**
 * @author safe
 * @create 2022-08-31 13:20
 * @introduction
 */
@SpringBootApplication
@EnableEurekaClient
// 开启服务熔断
@EnableHystrix
//@EnableCircuitBreaker
public class MainHystrixProvider8005 {
    public static void main(String[] args) {
        SpringApplication.run(MainHystrixProvider8005.class, args);
    }

//    @Bean
//    public ServletRegistrationBean servlet() {
//        HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
//        ServletRegistrationBean<HystrixMetricsStreamServlet> servletRegistrationBean = new ServletRegistrationBean<>(streamServlet);
//        servletRegistrationBean.setLoadOnStartup(1);
//        servletRegistrationBean.addUrlMappings("/hystrix.stream");
//        servletRegistrationBean.setName("hystrixMetricsStreamServlet");
//        return servletRegistrationBean;
//    }
}
